#pragma once
#include <list>
#include <audiere.h>
#include "sound.h"

class SoundManager : private audiere::StopCallback
{
private:
	audiere::AudioDevicePtr device;
	Sound* background;
	std::list<Sound*> foregroundSounds;
	float backgroundVolume;
	float foregroundVolume;

	void ADR_CALL ref() { }
	void ADR_CALL unref() { }
	void ADR_CALL streamStopped(audiere::StopEvent* event);

public:
	SoundManager();
	~SoundManager();
	bool initialize();

	void playBackground(Sound* sound);
	void pauseBackground();
	void stopBackground();

	void playForeground(Sound* sound);
	void pauseForeground(Sound* sound);
	void stopForeground(Sound* sound);

	float getBackgroundVolume();
	float getForegroundVolume();
	void setBackgroundVolume(float volume);
	void setForegroundVolume(float volume);

	void pauseAll();
	void resumeAll();
	void stopAll();

	audiere::AudioDevicePtr getAudiereDevice() { return device; }

};
